<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>get和Post</title>
    <script src="../../lib/jquery-3.4.1.js"></script>
    <link rel="stylesheet" href="../../CssTest/css/base.css">
    <link rel="stylesheet" href="../../lib/style/weui.css">
    <style>

        button{

            display: block;
            margin-top: 15px;
        }


    </style>
</head>
<body>

<button id="b1" class="weui-btn weui-btn_mini weui-btn_default">get请求</button>
<button id="b2" class="weui-btn weui-btn_mini weui-btn_default">post请求</button>


<script>


    $(document).ready(function () {


        $("#b1").click(function () {

        });

        $("#b2").click(function () {

            var url = "http://auth.Mobile.customs.gov.cn:7001/HGAuth/api/auth/login";

           var param = {"action":"DO","hgflag":"cgac\\xing_weixin","password":"670B14728AD9902AECBA32E22FA4F6BD"};

            $.ajax({
                url:url, //请求的url地址
                dataType:"json", //返回格式为json
                async:true,//请求是否异步，默认为异步，这也是ajax重要特性
                data:param, //参数值
                type:"post", //请求方式
                beforeSend:function(){
                    //请求前的处理

                    alert(1);
                },
                success:function(req){
                    //请求成功时处理
                    alert(2);
                },
                complete:function(){
                    //请求完成的处理

                    alert(3);
                },
                error:function(a,b,c){
                    //请求出错处理
                    alert(a + b + c);

                }
            });



        });


    })


</script>




</body>
</html>